﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DotNetNuke.Entities.Users;
using BrandonHaynes.Membership.Factors;

namespace BrandonHaynes.Membership
	{
	/// <summary>
	/// This class decorates a user by including a set of incomplete authentication factors in addition
	/// to the underlying user data.
	/// 
	/// Note that the user should be passed in as unhydrated as possible (as close to the getUserByWhatever call
	/// as possible) to avoid the penalty of double-hydration.
	/// 
	/// This class is used internally and not publically-exposed, because it is a tad hacky.  I suppose I could
	/// have stored the incomplete credentials in the profile, but that seemed expensive.
	/// </summary>
	internal class MultifactorUser : UserInfo
		{
		public MultifactorUser(UserInfo user)
			{
			this.AffiliateID = user.AffiliateID;
			this.DisplayName = user.DisplayName;
			this.Email = user.Email;
			this.FirstName = user.FirstName;
			this.IsDeleted = user.IsDeleted;
			this.IsSuperUser = user.IsSuperUser;
			this.LastIPAddress = user.LastIPAddress;
			this.LastName = user.LastName;
			this.PortalID = user.PortalID;
			this.RefreshRoles = user.RefreshRoles;
			this.UserID = user.UserID;
			this.Username = user.Username;

			this.Membership = user.Membership;
			this.Profile = user.Profile;
			//this.Roles = user.Roles;
			}

		public IList<IAuthenticationFactor> MissingCredentials { get; internal set; }
		}
	}
